package top.loveeveryone.configPage.param;

public class Result<T>{
    public static final String SUCCESS_STATUS = "1";
    public static final String FAIL_STATUS = "-1";
    private String status = "";
    private String msg = "";
    private T data;
    public Result(){}
    public Result(String status,String msg){
        this.status = status;
        this.msg = msg;
    }
    public Result(String status,String msg,T data){
        this.status = status;
        this.msg = msg;
        this.data = data;
    }
    public static <T> Result success(){
        return new Result<T>(SUCCESS_STATUS,"请求成功");
    }
    public static <T> Result success(T data){
        return new Result(SUCCESS_STATUS, "请求成功",data);
    }
    public static <T> Result fail(){
        return new Result(FAIL_STATUS,"请求失败");
    }
    public static <T> Result fail(T data){
        return new Result(FAIL_STATUS,"请求失败",data);
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
